<?PHP
 session_start();
 include("admin/include/db.php");
 include("includes/session.php");
 
 $userId = $_SESSION['user_id'];

 $sqlCourseData = mysql_query("SELECT sf.*,first_name,email 
												FROM software_courses as sf 
													LEFT JOIN software_user AS SU ON SU.id = sf.trainer_id 
												WHERE sf.batch_code = '".$_REQUEST['course_id']."'");
 $resCourseData  = mysql_fetch_array($sqlCourseData);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=TITLE_WEBSITE?></title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<center>
<div style="background:#179cc1; height:3px">&nbsp;</div>
<div style="width:990px;" align="center">
		<div id="header">
		<?php
    		include("includes/header.php");
   		?>
        </div>
    <div style="margin-top:20px;">
    	 <div style=" width:25%; float:left" >
        	 <?php include("includes/studentLeftMenu.php");?>
        </div>
        <div style="width:75%;float:left">
        	<table id="signInTbl" width="719" cellspacing="0" cellpadding="0" style="border:solid #cccccc 1px; background:#F0F0F0" class=" text">
                <tr style=" background:#000;color:#FFF; font-weight:bold" height="30" >
                            	<td style="color:#FFF" colspan="3">&nbsp;Course Schedule</td>
                             
                </tr>
                <tr height="30">
                    <td width="249" align="left" style="padding-left:15px"> Course</td>
                    <td width="466" align="left">
                      
                        <select id="courses" name="courses" onchange="window.location.href='std_cls_courses.php?course_id='+this.value" >
                            <option value="" >Select</option>
                            <?php
                             $sqlCourses = mysql_query("SELECT * FROM software_users_courses_assign where user_id = '$userId'");
                             while($resCourses = mysql_fetch_array($sqlCourses)){
                                ?>
                            <option value="<?=$resCourses["courses_id"]?>" <?=$_REQUEST['course_id'] == $resCourses ["courses_id"] ? 'selected=selected' : '' ?> ><?=$resCourses["courses_id"]?></option>
                            <?php		
                            }
                            ?>
                        </select>
                    </td>
                </tr>
                <?php
                  	if($_REQUEST['course_id'] == '')
					{
				  ?>
                  <tr style="background: #D9D9FD " height="25">
                 	<td colspan="2"><div align="left" class="successMsg" id="err_site" style="display:block">
                       &nbsp; <strong><?=('Select your course please for checking details.')?></strong>
                    </div></td>
                  </tr>
                  <?php
				    exit();
                  	}
				 ?> 
                <tr height="30">
                    <td width="249" align="left" style="padding-left:15px">User Course</td>
                    <td width="466" align="left">
                    	<?=($resCourseData["category"])?>                       
                    </td>
                </tr> 
                 <tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Course Code</td>
                    <td width="466" align="left">
                     <?=$resCourseData["batch_code"]?>                   </td>
                </tr>
                <tr height="30">
                    <td width="249" align="left" style="padding-left:15px"> Course Start Date</td>
                    <td width="466" align="left">
                       <?=($resCourseData["start_date"] != '' ? $resCourseData["start_date"] : '')?></td>
                </tr>
				<tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Course End Date</td>
                    <td width="466" align="left">
                     	<?=($resCourseData["end_date"] != '' ? $resCourseData["end_date"] : '')?></td>
                  </tr>
              
                   <tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Number of classes</td>
                    <td width="466" align="left">
                   	<?=($resCourseData["number_classes"])?>
                    </select>
                    </td>
                  </tr>
              	<tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Course Comments</td>
                    <td width="466" align="left">
                      <?=nl2br($resCourseData["comments"])?>                  </td>
                  </tr>
                  <tr  height="30">
                    <td width="249" align="left" style="padding-left:15px">Active</td>
                    <td width="466" align="left">
                    		<?=('N' == $resCourseData['active'] ? 'Not' : 'Yes')?>
                        </select>                    </td>
                  </tr>
                  
                   
                  <tr>
                  	<td colspan="2" >&nbsp;</td>
                  </tr>
                  
					 </table><br/><br/>
                    <table>
                    <tr>
                  	<td colspan="2" align="center">
                   	  <table width="715" style="border:1px solid #000" class="text" >
                        	 <tr style=" background:#000;color:#FFF; font-weight:bold" height="30" >
                            	<td style="color:#FFF" colspan="5">&nbsp;Course Schedule</td>
                             
                			</tr>
                            <tr style=" background:#4D4D4D;color:#FFF; font-weight:bold">
                            	<td style="color:#FFF" width="30%">Class</td>
                                <td style="color:#FFF">Start Time</td>
                                <td style="color:#FFF">End Time</td>
        
                            </tr>
                            <?php
							 $numberClasses = $resCourseData["number_classes"];
							 $sqlScheduleClass = mysql_query("SELECT * FROM software_schedule_class  where course = '".$resCourseData["batch_code"]."'");
							 while($resScheduleClass = mysql_fetch_array($sqlScheduleClass)){
								 $showClasses = 1;
								 $arrCourseClass[$resScheduleClass["course_class"]]['start_date'] = $resScheduleClass["start_time"];
								 $arrCourseClass[$resScheduleClass["course_class"]]['end_date']   = $resScheduleClass["end_time"];
								 
							 }
							if($showClasses)
							{							
                            	for($i=1;$i<=$numberClasses;$i++)
								{
									if($x%2) $bgColor = 'bgcolor = "#FFFFFF"'; else $bgColor = 'bgcolor = "#CCCCCC"';
										 $x++;
							?>
                            <tr <?=$bgColor?> height="25"  >
                            	
                                <td >Class<?=$i?></td>
                                <td ><?=($arrCourseClass[$i]["start_date"] == '' ? 'NA' : $arrCourseClass[$i]["start_date"])?></td>
                                <td><?=($arrCourseClass[$i]["end_date"] == '' ? 'NA' : $arrCourseClass[$i]["end_date"])?></td>
                           
                            </tr>
                           <?php
								}
							}if(!$showClasses){
							?>
                            <tr  style="background: #FFE9E9" >	
                            	
                                <td colspan="6"  class="clsError" >No,classes scheduled</td>
                           </tr>
                            <?php
							}
							?>
							
						</table>
                    
                    </td>
                  </tr>
                    </table>
                    </td>
                  </tr>
                  <tr>
                  				<td colspan="2" >&nbsp;</td>
                  			</tr>
                </table>
        	
        </div>
        <div style="clear:both"></div>
    </div>
    
    <div style="margin-top:23px; margin-bottom:21px" align="center" >
    	<?php
									$sqlAdvertise = mysql_query("SELECT * FROM software_advertise 
																	WHERE 
																		banner_status = 'Y' AND banner = 2
																		ORDER BY RAND()
																		");
									$resAdvertise = mysql_fetch_array($sqlAdvertise);
							
									$imgPath  = 'admin/upload_images/'.$resAdvertise["banner_image"];
									
								?>
								
    </div>
   </div>
   <div id="footer">
  		<?php include("includes/footer.php")?>
   </div>
</div>
	</div>
</center>
</body>
</html>
